# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=oslo-i18n
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=4.0.1
pkgrel=1
pkgdesc="Oslo i18n library (mingw-w64)"
arch=('any')
url='https://pypi.python.org/pypi/oslo.i18n/'
license=('Apache')
depends=("${MINGW_PACKAGE_PREFIX}-python" 
         "${MINGW_PACKAGE_PREFIX}-python-six"
         "${MINGW_PACKAGE_PREFIX}-python-pbr"
         "${MINGW_PACKAGE_PREFIX}-python-babel")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
options=('staticlibs' 'strip' '!debug')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/openstack/oslo.i18n/archive/${pkgver}.tar.gz")
sha512sums=('d12bed17cae4f30b4b7525f32e8e75c5067eabcab63f880d9865da34f7dc49a0dec313869a26222a4800bfbb178691de42ab473130e93598b0fda508ca90cd8c')

prepare() {
  cd "${srcdir}/oslo.i18n-${pkgver}"

  # Set version for setuptools_scm
  export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
  # Set version for python_pbr
  export PBR_VERSION=$pkgver
}

build() {
  cd "${srcdir}/oslo.i18n-${pkgver}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

check() {
  cd "${srcdir}/oslo.i18n-${pkgver}"
  ${MINGW_PREFIX}/bin/python setup.py check
}

package() {
  cd "${srcdir}/oslo.i18n-${pkgver}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build
}
